package de.cbf.cam.dsa.entity.edit.talent.persister.db4o.client.act;

import java.util.Hashtable;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

import de.cbf.cam.dsa.entity.edit.talent.persister.db4o.client.service.ServiceFactoryPersister_EntityTalent_Db4o;
import de.cbf.cam.dsa.entity.edit.talent.resolver.persister_interface.IServicePersister_EntityTalent;

/**
 * The activator class controls the plug-in life cycle
 */
public class ActivatorEntityTalent_Db4oClient extends AbstractUIPlugin {

	// The plug-in ID
	public static final String PLUGIN_ID = "de.cbf.cam.dsa.entity.edit.talent.persister.db4o.client"; //$NON-NLS-1$

	// The shared instance
	private static ActivatorEntityTalent_Db4oClient plugin;
	
	/**
	 * The constructor
	 */
	public ActivatorEntityTalent_Db4oClient() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
		
		registerServiceEntityTalentPersisterDB4OClient(context);
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static ActivatorEntityTalent_Db4oClient getDefault() {
		return plugin;
	}

	protected void registerServiceEntityTalentPersisterDB4OClient(BundleContext context) {		
		context.registerService(
				IServicePersister_EntityTalent.class.getName()
				,new ServiceFactoryPersister_EntityTalent_Db4o()
				,new Hashtable<String, Object>());
	}
}
